﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace BLL.Models
{
    public class MScriptServicesModels
    {
        /// <summary>
        /// 树形导航菜单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string DTree(string id) {

            string ret = string.Empty;
  
           BLL.DTreeJSONHelper json = new BLL.DTreeJSONHelper();
            DataSet ds = null;
            Library.SqlProvider.OleDb db=new Library.SqlProvider.OleDb();
            string str_sql = "select * from tb_mc_nav where parentid=" + id + " order by [number] desc ";
            try{
            
                ds=db.ExecuteDataset(COMM.PucConfig.ConnectionStringA,CommandType.Text,str_sql);
                        }catch(Exception ex){}



            foreach (DataRow dr in ds.Tables[0].Rows)
            {


                json.AddItem("id", dr["id"].ToString());
                json.AddItem("parentid", dr["parentid"].ToString());
                json.AddItem("text", dr["title"].ToString());
                json.AddItem("leaf", dr["leaf"].ToString());
                json.AddItem("iconCls", dr["iconCls"].ToString());
                json.AddItem("number", dr["number"].ToString());
                json.AddItem("url", dr["url"].ToString());
                json.ItemOk();




            }
            ret=json.ToString();

            return ret;
        }
    }
}
